<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function login({url,username,password}){
            let promise = new promise((resolve,rejest) =>{
                $.ajax({
                    url,
                    data:{username,password},
                    headers:{},
                    type:'GET',
                    cache:false,
                    success(res){
                        resolve(res)
                    },
                    error(e){
                        rejest(e)
                    }
                })
            })
            return promise
        }
        $(function() {
      let promise = login({
        url: 'http://192.168.102.7:8888/api/private/v1/login',
        username: 'admin1',
        password: '123456'
      })
      //取出异步执行的结果
      promise.then(res => {
        console.log(res)
      }).catch(e => {
        console.log(e)
      })
    })
    </script>
</head>
<body>
    <div id="app"></div>
</body>
</html>